{%extends "issue_base.html"%}
{%block title1%}Publish+Mail -{%endblock%}
{%block head%}{{form.media}}{%endblock%}
{%block issue_body%}
<script><!--
function discard(btn) {
  draftMessage.discard();
  btn.disabled = "disabled";
  document.getElementById("id_message").value = "";
  return false;
}
draftMessage = new M_draftMessage({{issue.key.id}}, true);
// -->
</script>
<h2>Publish + Mail Draft Comments</h2>

<div>
  <form action="{%url codereview.views.publish issue.key.id%}"
        method="post" id="publish-form">
  <input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
  <table>
  {%ifnotequal user issue.owner%}
  <tr><th>Subject:</th><td>{{issue.subject}}</td></tr>
  {%endifnotequal%}
  {{form}}
  <tr>
    <td></td>
    <td><i>The message will be included in the email sent (if any).</i></td>
  </tr>
  <tr>
    <td></td>
    <td>
      <input type="submit" value="Publish All My Drafts" />
      {%if draft_message%}
      <input type="button" onclick="return discard(this);"
	     value="Discard Message" />
      {%endif%}
     </td>
  </tr>
  </table>
  </form>

  <a id="resizer" style="display:none;cursor:pointer">
  <img src="{{media_url}}zippyplus.gif"></a>
  <script language="JavaScript" type="text/javascript"><!--
  M_addTextResizer_(document.getElementById("publish-form"));
  document.getElementById("id_message").focus();
  --></script>

</div>
{%if preview%}
<div style="margin-top: 3em;">
  <h3>Unpublished Drafts:</h3>
  <pre class="description">{{preview|wordwrap:"80"|urlizetrunc:80}}</pre>
</div>
{%endif%}
<div style="clear:both"></div>

{%endblock%}
